package java101.Cheats;

public class ConditionalExpressions {


	public static final int VARIABLE = 3;
	public static final int VARIABLEALT = 5;
	public static void main(String[] args) {
				
		System.out.println("Equals to: ");
		if (VARIABLE == 3) {
			System.out.println("VARIABLE = " + VARIABLE + ". VARIABLE is equal to 3.");
		}
		else {
			System.out.println("VARIABLE = " + VARIABLE + ". VARIABLE is not equal to 3.");
		}
		
		System.out.println("--");
		
		System.out.println("Not equals to: ");
		if (VARIABLEALT != 3) {
			System.out.println("VARIABLEALT = " + VARIABLEALT + ". VARIABLEALT is not equal to 3.");
		}
		else {
			System.out.println("VARIABLEALT = " + VARIABLEALT + ". VARIABLEALT is equal to 3.");
		}
		
		System.out.println("--");
		
		System.out.println("Or statements: ");
		if (VARIABLE == 3 || VARIABLE == 4) {
			System.out.println("VARIABLE = " + VARIABLE + ". VARIABLE is equal to either 3 or 4.");
		}
		else  {
			System.out.println("VARIABLE = " + VARIABLE + ". VARIABLE is not equal to either 3 or 4.");
		}
		
		System.out.println("--");
		
		System.out.println("And statements: ");
		if (VARIABLE== 3 && VARIABLEALT == 8) {
			System.out.println("VARIABLE = " + VARIABLE + ". VARIABLEALT = " + VARIABLEALT + ". VARIABLE is equal to 3 AND VARIABLEALT is equal to 8.");
		}
		else {
			System.out.println("VARIABLE = " + VARIABLE + ". VARIABLEALT = " + VARIABLEALT + ". Either VARIABLE does not equal 3 or VARIABLEALT does not equal 8, or both.");
		}
		
		System.out.println("--");
		
		System.out.println("Nested statements: ");
		String b = "Allo!";
		if (b != null) {
			if (b.contains("H")) {
				System.out.println("b = " + b + ". String f is not null and contains the letter H.");
			}
			else if (!b.contains("H")) {
				System.out.println("f = " + b + ". String f is not null but does not contain the letter H.");
			}	
		}
		else {
			System.out.println("f = " + b + ". String f is null. :(");
		}
		
		System.out.println("--");
		
		System.out.println("Greater than/Less than statements: ");
		if (VARIABLE <= VARIABLEALT) {
			System.out.println("VARIABLE = " + VARIABLE + ". VARIABLEALT = " + VARIABLEALT + ". VARIABLE is less than or equal to VARIABLEALT.");
		}
		else {
			System.out.println("VARIABLE is greater than VARIABLEALT.");
		}
		
		System.out.println("--");
		
		System.out.println("Expressions used in print: ");
		Integer i = new Integer (4);
		int j = 4;
		System.out.print("j = " + j + ". i = " + i + ". Is j = i? "); 
		System.out.println(j==i); //You can also use "System.out.println(i.equals(j));".
		
		System.out.println("--");
		
		System.out.println("Switch case: "); //Type "switch" and then ctl + space
		switch (VARIABLE) { //Concerning the value of VARIABLE, this replaces "if" and "else if". Always end every case with "break;".
		case 1:
			System.out.println("You chose 1.");
			break;
		case 2:
			System.out.println("You chose 2.");
			break;
		default: //It goes to this if it matches nothing above.
			System.out.println("You did not choose 1 or 2.");
			break;
		}
		
		System.out.println("--");
		
		System.out.println(" ");
		
	}

	
}